package cn.edu.sptc.LiXin.hellosprring.runner;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;

@Slf4j
@Component
public class MyApplicationRunner implements ApplicationRunner {
    public static void main(String[] args) {
        SpringApplication.run(MyApplicationRunner.class, args);
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
//        log.info("这是一个应用程序运行器");
        log.info("应用冷启动完成报时，当前时刻为：" + getDateTimeByLocalDateTime());
    }

    private String getDateTimeByLocalDateTime() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS EEE");
        return dateFormat.format(System.currentTimeMillis());
    }


}
